package cn.edu.sjtu.se.dslab.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.edu.sjtu.se.dslab.component.data.DataAttribute;
import cn.edu.sjtu.se.dslab.component.data.DataEntity;
import cn.edu.sjtu.se.dslab.dao.IDataAttributeDao;
import cn.edu.sjtu.se.dslab.service.IDataAttributeService;

@Service("dataAttributeService")
@Transactional
public class DataAttributeServiceImpl implements IDataAttributeService {

	@Resource(name = "dataAttributeDao")
	private IDataAttributeDao dataAttributeDao;

	@Override
	public boolean addDataAttribute(DataAttribute attribute) {
		// TODO Auto-generated method stub
		dataAttributeDao.save(attribute);
		return true;
	}

	@Override
	public boolean updateDataAttribute(DataAttribute attribute) {
		// TODO Auto-generated method stub
		dataAttributeDao.update(attribute);
		return true;
	}

	@Override
	public DataAttribute getDataAttributeById(long id) {
		// TODO Auto-generated method stub
		return dataAttributeDao.queryById(id);
	}

	@Override
	public List<DataAttribute> getDataAttributeByDataEntity(DataEntity entity) {
		// TODO Auto-generated method stub
		return dataAttributeDao.queryByDataEntity(entity);
	}

}
